import 'dart:convert';

CategoryModel userInfoModelFromJson(String str) => CategoryModel.fromJson(json.decode(str));

String userInfoModelToJson(CategoryModel data) => json.encode(data.toJson());

class CategoryModel {
  int code;
  String ? message;
  List<CategoryData> ? data;

  
  CategoryModel({
    required this.code,
    this.message,
    this.data,
  });

  factory CategoryModel.fromJson(Map<String, dynamic> json) => CategoryModel(
    code: json["code"],
    message: json["message"],
    data: List<CategoryData>.from(json["data"].map((x) => CategoryData.fromJson(x))),
  );

  Map<String, dynamic> toJson() => {
    "code": code,
    "message": message,
    "data": List<dynamic>.from(data!.map((x) => x.toJson())),
  };
}

class CategoryData {
  int id;
  String name;
  String img;


  CategoryData({
    required this.id,
    required this.name,
    required this.img,
  });

  factory CategoryData.fromJson(Map<String, dynamic> json) => CategoryData(
    id: json["id"],
    name: json["name"],
    img: json["img"],
  );

  Map<String, dynamic> toJson() => {
    "id": id,
    "name": name,
    "img": img,
  };
}
